package com.example.springbootpro.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private String code;
    private String message;
    private T data;
    

    public static <T> Result<T> success(T data) {
        return new Result<>("200", "success", data);
    }
    
    public static <T> Result<T> success(T data,String message) {
        return new Result<>("200", message, data);
    }


    public static <T> Result<T> error(String code, String message) {
        return new Result<>(code, message, null);
    }

    public static Result<String> error(String message) {
        return new Result<>("500", message, null);
    }
}